#include"locker.h"



bool locker::lock(){
     return pthread_mutex_lock(&m_mutex)==0;
}

bool locker::unlock(){
    return pthread_mutex_unlock(&m_mutex)==0;
}

pthread_mutex_t* locker::get(){
    return &m_mutex;
}

bool cond::wait(pthread_mutex_t* mutex){
    return pthread_cond_wait(&m_cond,mutex);
}

bool cond::timewait(pthread_mutex_t* mutex,const struct timespec time){
        return pthread_cond_timedwait(&m_cond,mutex,&time);
}

bool cond::signal(){
    return pthread_cond_signal(&m_cond)==0;
}

bool cond::broadcast(){
    return pthread_cond_broadcast(&m_cond)==0;
}

bool sem::wait(){
    return sem_wait(&m_sem)==0;
}

bool sem::post(){
    return sem_post(&m_sem)==0;
}

